home *** CD-ROM | disk | FTP | other *** search
/ Champak 33 / Volume 33 - JOGO DISK .iso / Games / rocketman.swf / scripts / DefineSprite_484 / frame_1 / DoAction.as
Text File  |  2007-01-12  |  15KB  |  580 lines

  1. function addPopUp(x, y, text, col, ydif, alpha)
  2. {
  3.    temp = this.attachMovie("Popup","PopUp" + pu,pu);
  4.    temp._x = x;
  5.    temp._y = y;
  6.    temp.gfx.text = text;
  7.    temp._alpha = alpha;
  8.    if(col != 32)
  9.    {
  10.       temp.gfx.gotoAndStop(col);
  11.    }
  12.    if(temp._x - temp._width / 2 < - superg.destx + 20)
  13.    {
  14.       temp._x = - superg.destx + 20 + temp._width / 2;
  15.    }
  16.    if(temp._x + temp._width / 2 > - superg.destx + sw + 20)
  17.    {
  18.       temp._x = - superg.destx + sw + 20 - temp._width / 2;
  19.    }
  20.    if(temp._y - 50 < - superg.desty)
  21.    {
  22.    }
  23.    pu++;
  24. }
  25. function fireFrame()
  26. {
  27.    this.ticks = this.ticks + 1;
  28.    if(this.work == 0)
  29.    {
  30.       if(this.ticks > this.timeoff)
  31.       {
  32.          this.ticks = 0;
  33.          this.work = 1;
  34.          this.gfx.play();
  35.       }
  36.    }
  37.    else if(this.ticks > this.timeon)
  38.    {
  39.       this.ticks = 0;
  40.       this.work = 0;
  41.       this.gfx.play();
  42.    }
  43. }
  44. function fireLand(override)
  45. {
  46.    if(override == undefined)
  47.    {
  48.       override = 0;
  49.    }
  50.    if(override)
  51.    {
  52.       if(!fire)
  53.       {
  54.          return 0;
  55.       }
  56.    }
  57.    if(this.work || override)
  58.    {
  59.       superg.gotoAndStop("burning");
  60.       superg.yspeed = -10;
  61.       superg.soundClip.gotoAndStop("fire");
  62.       superg.xspeed = -3 + random(6);
  63.       superg.die = 1;
  64.       superg.dead = 1;
  65.       superg.go = 1;
  66.       superg.aim = 0;
  67.       superg.flying = 1;
  68.       return 1;
  69.    }
  70.    this.gfx.gotoAndStop(1);
  71.    this.onEnterFrame = null;
  72. }
  73. function fireReset()
  74. {
  75.    this.ticks = 0;
  76.    this.work = 0;
  77.    this.gfx.gotoAndStop(1);
  78.    this.gotoAndStop(1);
  79.    this.onEnterFrame = this.frame;
  80. }
  81. function crumbleReset()
  82. {
  83.    this.gfx.gotoAndStop(1);
  84.    this.gotoAndStop(1);
  85.    this.timer = 0;
  86.    this.crumble = 0;
  87.    this.kill = 1;
  88.    this.onEnterFrame = null;
  89. }
  90. function crumbleStanding()
  91. {
  92.    this.timer = this.timer + 1;
  93.    if(this.timer > this.time)
  94.    {
  95.       if(this.gfx._currentframe == 1)
  96.       {
  97.          this.gfx.play();
  98.       }
  99.       if(this.timer > this.time + this.crumbletime)
  100.       {
  101.          if(this.kill)
  102.          {
  103.             if(!this.crumble)
  104.             {
  105.                this.crumble = 1;
  106.                superg.gotoAndStop("diefalling");
  107.                superg.yspeed = 0;
  108.                superg.xspeed = 0;
  109.                superg.oldy = 50000;
  110.                superg.die = 1;
  111.                superg.dead = 1;
  112.                superg.go = 1;
  113.                superg.aim = 0;
  114.                superg.flying = 1;
  115.                superg.firstdie = 1;
  116.                aimer._visible = 0;
  117.             }
  118.          }
  119.       }
  120.    }
  121. }
  122. function crumbleLaunch()
  123. {
  124.    this.gfx.play();
  125.    this.crumble = 1;
  126.    this.kill = 0;
  127. }
  128. function movingFrame()
  129. {
  130.    this.ticks = this.ticks + 1;
  131.    if(this.ticks > this.movetime)
  132.    {
  133.       this.ticks = 0;
  134.       this.dir = !this.dir;
  135.    }
  136.    if(this.dir)
  137.    {
  138.       this._x += this.xspeed;
  139.       this._y += this.yspeed;
  140.    }
  141.    else
  142.    {
  143.       this._x -= this.xspeed;
  144.       this._y -= this.yspeed;
  145.    }
  146. }
  147. function movingLand(override)
  148. {
  149.    this.onEnterFrame = null;
  150. }
  151. function movingReset()
  152. {
  153.    this.onEnterFrame = this.frame;
  154. }
  155. function setUpPickups(clip)
  156. {
  157.    clip.world = this;
  158.    clip.p = 0;
  159.    clip.pArray = new Array();
  160.    clip.pickUp = doPickups;
  161.    clip.unPickUp = removePickups;
  162. }
  163. function stationaryPickup()
  164. {
  165.    if(this.hitTest(superg))
  166.    {
  167.       this.parent.pArray[this.pos][2] = 1;
  168.       _parent.knuggs += snumber;
  169.       addPopUp(this._x,this._y,"flower: +" + snumber,2);
  170.       superg.soundClip.gotoAndPlay("powerup");
  171.       this.removeMovieClip("");
  172.    }
  173. }
  174. function movingPickup()
  175. {
  176.    this.ticks = this.ticks + 1;
  177.    this._x += this.xspeed;
  178.    this._y += this.yspeed;
  179.    if(this.xspeed < 0)
  180.    {
  181.       this.fire._xscale = -100;
  182.    }
  183.    if(this.ticks > this.time)
  184.    {
  185.       this._x = this.startx;
  186.       this._y = this.starty;
  187.       this.ticks = 0;
  188.    }
  189.    if(this.hit.hitTest(superg))
  190.    {
  191.       this.parent.pArray[this.pos][2] = 1;
  192.       _parent.boost = Math.min(_parent.boost + 25,100);
  193.       addPopUp(this._x,this._y,"extra fuel!",2);
  194.       superg.soundClip.gotoAndPlay("booster");
  195.       this.removeMovieClip("");
  196.    }
  197. }
  198. function addPickup(clip, x, y, type, pass)
  199. {
  200.    clip.pArray[clip.p] = new Array();
  201.    clip.pArray[clip.p][0] = x;
  202.    clip.pArray[clip.p][1] = y;
  203.    clip.pArray[clip.p][2] = 0;
  204.    clip.pArray[clip.p][3] = type;
  205.    if(pass != undefined)
  206.    {
  207.       clip.pArray[clip.p][4] = pass;
  208.    }
  209.    clip.p = clip.p + 1;
  210. }
  211. function doPickups()
  212. {
  213.    var i = 0;
  214.    while(i < this.p)
  215.    {
  216.       if(!this.pArray[i][2])
  217.       {
  218.          if(this.pArray[i][4] != undefined)
  219.          {
  220.             if(this.pArray[i][3] == 2)
  221.             {
  222.                var temp = this.world.attachMovie("moveObject",this._name + "_pickup_" + i,piu++,this.pArray[i][4]);
  223.             }
  224.             else if(this.pArray[i][3] == 3)
  225.             {
  226.                var temp = this.world.attachMovie("killObject",this._name + "_pickup_" + i,piu++,this.pArray[i][4]);
  227.             }
  228.             else if(this.pArray[i][3] == 4)
  229.             {
  230.                var temp = this.world.attachMovie("electricObject",this._name + "_pickup_" + i,piu++,this.pArray[i][4]);
  231.             }
  232.             else
  233.             {
  234.                var temp = this.world.attachMovie("object",this._name + "_pickup_" + i,piu++,this.pArray[i][4]);
  235.             }
  236.          }
  237.          else if(this.pArray[i][3] == 3)
  238.          {
  239.             var temp = this.world.attachMovie("killObject",this._name + "_pickup_" + i,piu++);
  240.          }
  241.          else
  242.          {
  243.             var temp = this.world.attachMovie("object",this._name + "_pickup_" + i,piu++);
  244.          }
  245.          temp._x = this.pArray[i][0];
  246.          temp._y = this.pArray[i][1];
  247.          if(this.pArray[i][3] == 2)
  248.          {
  249.             temp.onEnterFrame = movingPickup;
  250.          }
  251.          else if(this.pArray[i][3] == 3)
  252.          {
  253.             temp.onEnterFrame = killingPickup;
  254.          }
  255.          else if(this.pArray[i][3] == 4)
  256.          {
  257.             temp.onEnterFrame = electricPickup;
  258.             electricPickupSetup(temp);
  259.          }
  260.          else
  261.          {
  262.             temp.onEnterFrame = stationaryPickup;
  263.          }
  264.          temp.pos = i;
  265.          temp.parent = this;
  266.       }
  267.       i++;
  268.    }
  269. }
  270. function removePickups()
  271. {
  272.    var i = 0;
  273.    while(i < this.p)
  274.    {
  275.       this.world[this._name + "_pickup_" + i].removeMovieClip("");
  276.       i++;
  277.    }
  278. }
  279. w = 90;
  280. h = 25;
  281. sw = 510;
  282. sh = 400;
  283. startx = 0;
  284. starty = 400;
  285. p = 6000;
  286. piu = 4000;
  287. pu = 100000;
  288. mt = 0;
  289. snumber = 10;
  290. baseLives = 5;
  291. reset();
  292. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  293. temp._x = startx + w / 2;
  294. temp._y = starty;
  295. superg._x = temp._x;
  296. superg._y = temp._y - h;
  297. setUpPickups(temp);
  298. addPickup(temp,startx + 130,starty - 103,1);
  299. addPickup(temp,startx + 157,starty - 91,1);
  300. addPickup(temp,startx + 101,starty - 92,1);
  301. temp.pickUp();
  302. mt++;
  303. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  304. temp._x = startx + 175 + w / 2;
  305. temp._y = starty;
  306. startx = temp._x;
  307. starty = temp._y;
  308. setUpPickups(temp);
  309. addPickup(temp,startx + 297,starty - 53,1);
  310. addPickup(temp,startx + 284,starty - 75,1);
  311. addPickup(temp,startx + 268,starty - 99,1);
  312. mt++;
  313. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt,pass);
  314. temp._visible = 0;
  315. temp._x = startx + 250 + w / 2;
  316. temp._y = starty;
  317. startx = temp._x;
  318. starty = temp._y;
  319. setUpPickups(temp);
  320. addPickup(temp,startx + 386,starty - 246,1);
  321. addPickup(temp,startx + 372,starty - 282,1);
  322. addPickup(temp,startx + 356,starty - 319,1);
  323. mt++;
  324. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  325. temp._x = startx + 375 + w / 2;
  326. temp._y = starty;
  327. temp._visible = 0;
  328. startx = temp._x;
  329. starty = temp._y;
  330. setUpPickups(temp);
  331. pass = {xspeed:5,yspeed:0,startx:startx - 75,starty:starty - 300,time:150};
  332. addPickup(temp,startx - 75,starty - 300,2,pass);
  333. mt++;
  334. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  335. temp._x = startx + 222 + w / 2;
  336. temp._y = starty - 79;
  337. temp._visible = 0;
  338. startx = temp._x;
  339. starty = temp._y;
  340. setUpPickups(temp);
  341. addPickup(temp,startx + 248,starty - 54,1);
  342. mt++;
  343. pass = {time:80,crumbletime:15,work:0};
  344. temp = this.attachMovie("basePlatformCrumble","basePlatform" + mt,mt,pass);
  345. temp.standing = crumbleStanding;
  346. temp.launch = crumbleLaunch;
  347. temp.reset = crumbleReset;
  348. temp.reset();
  349. temp._x = startx + 200 + w / 2;
  350. temp._y = starty;
  351. temp._visible = 0;
  352. startx = temp._x;
  353. starty = temp._y;
  354. setUpPickups(temp);
  355. addPickup(temp,startx + 415,starty - 145,1);
  356. addPickup(temp,startx + 415,starty - 175,1);
  357. mt++;
  358. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  359. temp._x = startx + 375 + w / 2;
  360. temp._y = starty - 79;
  361. temp._visible = 0;
  362. startx = temp._x;
  363. starty = temp._y;
  364. setUpPickups(temp);
  365. addPickup(temp,startx + 51,starty - 256,1);
  366. addPickup(temp,startx + 58,starty - 285,1);
  367. addPickup(temp,startx + 65,starty - 315,1);
  368. mt++;
  369. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  370. temp._x = startx + 302 + w / 2;
  371. temp._y = starty - 209;
  372. temp._visible = 0;
  373. startx = temp._x;
  374. starty = temp._y;
  375. mt++;
  376. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  377. temp._x = startx + 116 + w / 2;
  378. temp._y = starty - 194;
  379. temp._visible = 0;
  380. startx = temp._x;
  381. starty = temp._y;
  382. setUpPickups(temp);
  383. addPickup(temp,temp._x + 248,temp._y - 49,1);
  384. mt++;
  385. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  386. temp._x = startx + 195 + w / 2;
  387. temp._y = starty;
  388. temp._visible = 0;
  389. temp.parent = 1;
  390. temp.inter = 1;
  391. setUpPickups(temp);
  392. addPickup(temp,temp._x + 1,temp._y - 216,1);
  393. addPickup(temp,temp._x + 1,temp._y - 236,1);
  394. addPickup(temp,temp._x + 1,temp._y - 256,1);
  395. mt++;
  396. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  397. temp._x = startx + 198 + w / 2;
  398. temp._y = starty - 175;
  399. temp._visible = 0;
  400. temp.inter = 1;
  401. setUpPickups(temp);
  402. addPickup(temp,startx + 422,starty - 53,1);
  403. mt++;
  404. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  405. temp._x = startx + 375 + w / 2;
  406. temp._y = starty;
  407. temp._visible = 0;
  408. startx = temp._x;
  409. starty = temp._y;
  410. mt++;
  411. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  412. temp._x = startx + 375 + w / 2;
  413. temp._y = starty;
  414. temp._visible = 0;
  415. temp.parent = 1;
  416. temp.inter = 1;
  417. setUpPickups(temp);
  418. addPickup(temp,startx + 51,starty - 231,1);
  419. addPickup(temp,startx + 61,starty - 260,1);
  420. addPickup(temp,startx + 72,starty - 290,1);
  421. mt++;
  422. pass = {time:80,crumbletime:15,work:0};
  423. temp = this.attachMovie("basePlatformCrumble","basePlatform" + mt,mt,pass);
  424. temp.standing = crumbleStanding;
  425. temp.launch = crumbleLaunch;
  426. temp.reset = crumbleReset;
  427. temp.reset();
  428. temp._x = startx + w / 2;
  429. temp._y = starty - 172;
  430. temp._visible = 0;
  431. temp.inter = 1;
  432. mt++;
  433. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  434. temp._x = startx + 4 + w / 2;
  435. temp._y = starty;
  436. temp._visible = 0;
  437. startx = temp._x;
  438. starty = temp._y;
  439. mt++;
  440. pass = {time:80,crumbletime:15,work:0};
  441. temp = this.attachMovie("basePlatformCrumble","basePlatform" + mt,mt,pass);
  442. temp.standing = crumbleStanding;
  443. temp.launch = crumbleLaunch;
  444. temp.reset = crumbleReset;
  445. temp.reset();
  446. temp._x = startx + 377 + w / 2;
  447. temp._y = starty - 9;
  448. temp._visible = 0;
  449. temp.parent = 1;
  450. temp.inter = 1;
  451. mt++;
  452. pass = {time:80,crumbletime:15,work:0};
  453. temp = this.attachMovie("basePlatformCrumble","basePlatform" + mt,mt,pass);
  454. temp.standing = crumbleStanding;
  455. temp.launch = crumbleLaunch;
  456. temp.reset = crumbleReset;
  457. temp.reset();
  458. temp._x = startx + 188 + w / 2;
  459. temp._y = starty - 186;
  460. temp._visible = 0;
  461. startx = temp._x;
  462. starty = temp._y;
  463. setUpPickups(temp);
  464. pass = {xspeed:5,yspeed:0,startx:startx - 75,starty:starty - 150,time:150};
  465. addPickup(temp,startx - 75,starty - 150,2,pass);
  466. mt++;
  467. temp = this.attachMovie("basePlatform","basePlatform" + mt,mt);
  468. temp._x = startx + 378 + w / 2;
  469. temp._y = starty - 278;
  470. temp._visible = 0;
  471. startx = temp._x;
  472. starty = temp._y;
  473. setUpPickups(temp);
  474. addPickup(temp,startx + 321,starty - 57,1);
  475. addPickup(temp,startx + 315,starty - 90,1);
  476. addPickup(temp,startx + 306,starty - 123,1);
  477. addPickup(temp,startx + 255,starty - 323,1);
  478. addPickup(temp,startx + 249,starty - 347,1);
  479. mt++;
  480. pass = {timeoff:50,timeon:25,work:0};
  481. temp = this.attachMovie("basePlatformFire","basePlatform" + mt,mt,pass);
  482. temp.frame = fireFrame;
  483. temp.land = fireLand;
  484. temp.reset = fireReset;
  485. temp._visible = 0;
  486. temp._x = startx + 275 + w / 2;
  487. temp._y = starty;
  488. startx = temp._x;
  489. starty = temp._y;
  490. mt++;
  491. pass = {time:80,crumbletime:15,work:0};
  492. temp = this.attachMovie("basePlatformCrumble","basePlatform" + mt,mt,pass);
  493. temp.standing = crumbleStanding;
  494. temp.launch = crumbleLaunch;
  495. temp.reset = crumbleReset;
  496. temp.reset();
  497. temp._x = startx + 355 + w / 2;
  498. temp._y = starty - 99;
  499. temp._visible = 0;
  500. temp.parent = 1;
  501. temp.inter = 1;
  502. mt++;
  503. pass = {timeoff:50,timeon:25,work:0};
  504. temp = this.attachMovie("basePlatformFire","basePlatform" + mt,mt,pass);
  505. temp.frame = fireFrame;
  506. temp.land = fireLand;
  507. temp.reset = fireReset;
  508. temp._visible = 0;
  509. temp._x = startx + 44 + w / 2;
  510. temp._y = starty - 260;
  511. temp._visible = 0;
  512. startx = temp._x;
  513. starty = temp._y;
  514. mt++;
  515. pass = {time:80,crumbletime:15,work:0};
  516. temp = this.attachMovie("basePlatformCrumble","basePlatform" + mt,mt,pass);
  517. temp.standing = crumbleStanding;
  518. temp.launch = crumbleLaunch;
  519. temp.reset = crumbleReset;
  520. temp.reset();
  521. temp._x = startx + 375 + w / 2;
  522. temp._y = starty - 9;
  523. temp._visible = 0;
  524. temp.parent = 1;
  525. temp.inter = 1;
  526. mt++;
  527. pass = {time:80,crumbletime:15,work:0};
  528. temp = this.attachMovie("basePlatformCrumble","basePlatform" + mt,mt,pass);
  529. temp.standing = crumbleStanding;
  530. temp.launch = crumbleLaunch;
  531. temp.reset = crumbleReset;
  532. temp.reset();
  533. temp._x = startx + 193 + w / 2;
  534. temp._y = starty - 172;
  535. temp._visible = 0;
  536. temp.inter = 1;
  537. mt++;
  538. pass = {time:80,crumbletime:15,work:0};
  539. temp = this.attachMovie("basePlatformCrumble","basePlatform" + mt,mt,pass);
  540. temp.standing = crumbleStanding;
  541. temp.launch = crumbleLaunch;
  542. temp.reset = crumbleReset;
  543. temp.reset();
  544. temp._x = startx + 5 + w / 2;
  545. temp._y = starty - 5;
  546. temp._visible = 0;
  547. temp.inter = 1;
  548. setUpPickups(temp);
  549. addPickup(temp,startx + 252,starty - 207,1);
  550. addPickup(temp,startx + 248,starty - 240,1);
  551. addPickup(temp,startx + 242,starty - 279,1);
  552. mt++;
  553. pass = {timeoff:50,timeon:25,work:0};
  554. temp = this.attachMovie("basePlatformFire","basePlatform" + mt,mt,pass);
  555. temp.frame = fireFrame;
  556. temp.land = fireLand;
  557. temp.reset = fireReset;
  558. temp._visible = 0;
  559. temp._x = startx + 192 + w / 2;
  560. temp._y = starty - 151;
  561. temp._visible = 0;
  562. startx = temp._x;
  563. starty = temp._y;
  564. setUpPickups(temp);
  565. addPickup(temp,startx + 433,starty - 209,1);
  566. addPickup(temp,startx + 452,starty - 241,1);
  567. addPickup(temp,startx + 470,starty - 274,1);
  568. addPickup(temp,startx + 453,starty - 311,1);
  569. addPickup(temp,startx + 432,starty - 343,1);
  570. mt++;
  571. temp = this.attachMovie("wormhole","wormhole",mt);
  572. temp._visible = 0;
  573. temp._x = startx + 375 + w / 2;
  574. temp._y = starty - 150;
  575. temp.standing = function()
  576. {
  577.    _parent.gotoAndPlay("endgame");
  578. };
  579. superg.maxtargets = mt;
  580.